<?php
class Item extends Vnf_Db_Table {
    protected $_name;
    protected $_primary = 'item_id';

    function __construct() {
        $this->_name = DB_PREFIX . "item";
        parent::__construct();
    }

    public function getColumns() {
        $results = array('item_id', 'item_title', 'category_id', 'item_image', 'item_short_description', 'item_description', 'item_order', 'item_status');
        return $results;
    }

    public function getPrimaryKey() {
        $pk = $this->_primary;
        if (is_array($pk)) {
            if (count($pk) > 0)
                return $pk[1]; // array[1] contain column name of primary key
        }
        return $this->_primary;
    }
    public function getRowSetByWhere($where = null,$count = 5, $offset = 0, $order = "i.item_id DESC"){
    	$select = Zend_Db_Table_Abstract::select();
    	$select->setIntegrityCheck(false);
    	$select->from(array('i'=> $this->_name));
    	if($where != null){
    		$select->where($where);
    	}
    	$select->limit($count,$offset);    	
    	$select->order($order);
    	
    	$data = $this->fetchAll($select);
        return $data;
    }
}
?>
